<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page import="java.util.*"%>
<%@ include file="/page/taglibs.jsp"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<%@ include file="/adapter/adapter-bootstrap.jsp"%>
<link
	href="${pageContext.request.contextPath}/frontframe/easyui/themes/easyui-extend.css"
	rel="stylesheet" type="text/css" />
<script type="text/javascript">
	function save() {
		var isadmin=document.getElementById("is_admin").value;
		if(isadmin==null||isadmin==''||isadmin==undefined){
			alert("请选择管理员权限");
			return false;
		}
		var str_data = $("#form1 input").map(function() {
			return ($(this).attr("name") + '=' + $(this).val());
		}).get().join("&");
		$.ajax({
			url : "${ctx}/appTblUser/updateTblUser",
			type : "POST",
			dataType : "json",
			data : $("#form1").serialize(),
			async : false,
			success : function(data) {
				if (data.model.flag > 0) {
					alert("修改成功！");
					//window.location.reload();
				}
				/* 	          $.each(data, function(index, element) {
				 window.location.reload();
				 }); */
			},
			error : function() {
				alert("error");
			}
		});

	}

	function changeValue(val) {
		document.getElementById("is_admin").value = val;
	}

	function goBack() {
		window.history.back(-1);
	}
</script>
</head>
<body>
	<div class="panel panel-default">
		<div class="panel-heading">
			<h3 class="panel-title">管理员信息页面</h3>
		</div>
		<div class="panel-body">
			<form class="form-horizontal" role="form" id="form1" name="form1" >
				<div class="form-group">

					<label class="col-xs-2 control-label" for="id">编号</label>
					<div class="col-xs-4">
						<input class="form-control" id="id" name="id" type="text"
							placeholder="" value="${appTblUser.id}" readonly="readonly"/>
					</div>


					<label class="col-xs-2 control-label" for="login_name">用户名</label>
					<div class="col-xs-4">
						<input class="form-control" id="login_name" name="login_name"
							type="text" placeholder="" value="${appTblUser.login_name}" readonly="readonly"/>
					</div>

				</div>
				<div class="form-group">

					<label class="col-xs-2 control-label" for="name">姓名</label>
					<div class="col-xs-4">
						<input class="form-control" id="name" name="name" type="text"
							placeholder="" value="${appTblUser.name}" />
					</div>
					<label class="col-xs-2 control-label"><font style="color: red;">*</font>权限类型</label>
                    <input type="hidden"  id="is_admin" name="is_admin" value='<c:choose><c:when test="${appTblUser.is_admin=='Y'}">0</c:when><c:when test="${appTblUser.is_developer=='Y'}">1</c:when><c:otherwise>2</c:otherwise></c:choose>'/>
                    <div style="vertical-align: middle;line-height: 33px;text-align: left;">
						<!-- <select id="chooseId" class="form-control"  onclick="changeValue(this.value)">
						   <option  value='' selected="selected">请选择</option>
						   <option  value='0'>管理员</option>
						   <option  value='1'>开发者</option>
						   <option  value='2'>配置者</option>
						</select>  --> 
						<input id="choose" name="choose" type="radio" value="0" <c:if test="${appTblUser.is_admin=='Y'}">checked="checked"</c:if> onclick="changeValue(this.value)" style="margin-left: 15px;margin-right: 7px;"/>管理员
						<input id="choose" name="choose" type="radio" value="1" <c:if test="${appTblUser.is_developer=='Y'}">checked="checked"</c:if> onclick="changeValue(this.value)" style="margin-left: 20px;margin-right: 7px;"/>开发者
						<input id="choose" name="choose" type="radio" value="2" <c:if test="${appTblUser.is_configer=='Y'}">checked="checked"</c:if> onclick="changeValue(this.value)" style="margin-left: 20px;margin-right: 7px;"/>配置者
                     </div>

				</div>
				<div class="form-group">
					<label class="col-xs-2 control-label" for="email">电子邮箱</label>
					<div class="col-xs-4">
						<input class="form-control" id="email" name="email" type="text"
							placeholder="" value="${appTblUser.email}" />
					</div>
					<label class="col-xs-2 control-label" for="remark">备注</label>
					<div class="col-xs-4">
						<textarea rows="3" id="remark" name="remark" class="form-control">${appTblUser.remark}</textarea>
						<%-- <input class="form-control" id="remark" name="remark" type="text"
							placeholder="" value="${appTblUser.remark}" /> --%>
					</div>
				</div>
				<%-- <div class="form-group">

					<label class="col-xs-2 control-label" for="is_developer">开发者</label>
					<div class="col-xs-4">
						<input class="form-control" id="is_developer" name="is_developer"
							type="text" placeholder="" value="${appTblUser.is_developer}" />
					</div>


					<label class="col-xs-2 control-label" for="is_configer">配置者</label>
					<div class="col-xs-4">
						<input class="form-control" id="is_configer" name="is_configer"
							type="text" placeholder="" value="${appTblUser.is_configer}" />
					</div>

				</div> --%>
				<%-- <div class="form-group">

					<label class="col-xs-2 control-label" for="status">用户状态</label>
					<div class="col-xs-4">
						<input class="form-control" id="status" name="status" type="text"
							placeholder="" value="${appTblUser.status}" />
					</div>

				</div> --%>
				<div class="form-group  text-center">
					<button type="button" class="btn btn-default" onclick="save();">保存</button>
					<button type="button" class="btn btn-default" onclick="goBack()">返回</button>
				</div>
			</form>
		</div>
	</div>

</body>
</html>
